import subprocess
from PySide6.QtCore import QThread, Signal


class StartWechatThread(QThread):
    error_signal = Signal(str)
    success_signal = Signal(str)

    def run(self):
        try:
            subprocess.run('inject_tool.exe start 8989 --my_port=9000', creationflags=subprocess.CREATE_NO_WINDOW,
                           shell=True)
            self.success_signal.emit('success')
        except FileNotFoundError:
            self.error_signal.emit('启动工具不存在...')
        except Exception as e:
            self.error_signal.emit(str(e))
